//
// Created by LiuYou on 2021/8/20.
//

#ifndef HIGHPERFORMANCELINUXSERVERPROGRAMMING_LINUX2_SEMAPHORE_HPP
#define HIGHPERFORMANCELINUXSERVERPROGRAMMING_LINUX2_SEMAPHORE_HPP


#include <semaphore.h>


/** 封装posix信号量。*/
class Semaphore {
public:
    /** 等待信号量。*/
    bool wait();

    /** 增加信号量。*/
    bool post();

public:
    Semaphore();

    ~Semaphore();

private:
    sem_t semaphore;

};


#endif //HIGHPERFORMANCELINUXSERVERPROGRAMMING_LINUX2_SEMAPHORE_HPP
